package com.adrian.controller;

import com.adrian.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Auther: Adrian
 * @Date: 2020/3/16 20:40
 * @Description:
 */

@RestController
@Scope("prototype")
public class ComuserController {

    @Resource
    private RestTemplate restTemplate;

    @RequestMapping("/comuser")
    public List<User> listUser(){

        String url ="http://127.0.0.1:8181/list";
        return this.restTemplate.getForObject(url,List.class);
    }
}
